import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/admin/system/admin/login',
    method: 'post',
    data
  })
}
export function phoneLogin(data) {
  return request({
    url: '/admin/system/admin/phoneLogin',
    method: 'post',
    data
  })
}
export function refreshToken() {
  return request({
    url: '/admin/system/admin/refreshToken',
    method: 'post'
  })
}

export function logout() {
  return request({
    url: '/admin/system/admin/logout',
    method: 'post'
  })
}

export function userList(data) {
  return request({
    url: '/admin/system/admin/list',
    method: 'get',
    params: data
  })
}

export function createUser(data) {
  return request({
    url: '/admin/system/admin/create',
    method: 'post',
    data
  })
}

export function updateUser(data) {
  return request({
    url: '/admin/system/admin/update',
    method: 'post',
    data
  })
}

export function deleteUser(data) {
  return request({
    url: '/admin/system/admin/delete',
    method: 'post',
    data
  })
}

export function resetUserPassword(data) {
  return request({
    url: '/admin/system/admin/resetPassword',
    method: 'post',
    data
  })
}

export function changePassword(data) {
  return request({
    url: '/admin/system/admin/changePassword',
    method: 'post',
    data
  })
}

export function updateUserSelf(data) {
  return request({
    url: '/admin/system/admin/updateUser',
    method: 'post',
    data
  })
}

export async function getWebsocketURL(data) {
  return request({
    url: '/admin/system/admin/websocket',
    method: 'post',
    data
  })
}
